#pragma once
#include"SystemHeaders.h"
#include"Texture.h"
#include"TextureSection.h"
#include"Animation.h"


class TextureManager
{
private:
	std::map<int,Texture*> textures;
	std::map<int,TextureSection*> texturesections;
	std::map<int,Animation*> animations;
	unsigned int idcounter;
	bool IsTexture( unsigned int id);
	bool IsTextureSection( unsigned int id);
	bool IsAnimation( unsigned int id);
public:
	TextureManager();
	~TextureManager();
	unsigned int AddTexture(std::string filename);
	unsigned int AddTexture(std::string filename, unsigned char red_alpha, unsigned char green_alpha, unsigned blue_alpha );
	unsigned int AddTextureSection(unsigned int TextureId);
	unsigned int AddTextureSection(unsigned int TextureId, float left, float top, float right, float bottom);	
	unsigned int CreateAnimation();
	bool PushSectionToAnimation(unsigned int AnimationId, unsigned int SectionId, float delay);
	bool PushTextureToAnimation(unsigned int AnimationId, unsigned int TextureId, unsigned int NumberOfFrames, float delay);
	bool Draw(unsigned int ElementId, int X, int Y, GLfloat Scale = 1,GLfloat Rotation = 0, GLfloat red = 1.0f, GLfloat green = 1.0f, GLfloat blue = 1.0f);
	void UpdateAnimations();
	void PlayAnimations();
	void PauseAnimations();
	void DeleteAnimations();
	void DeleteTextureSections();
	void DeleteTextures();
};